home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / std / c / 756 < prev    next >
Encoding:
Internet Message Format  |  1996-08-06  |  1.4 KB

  1. Path: lectra.fr!noe!phil
  2. From: phil@rd.lectra.fr (Philippe Maurisset)
  3. Newsgroups: comp.std.c
  4. Subject: Q: char **foo, char *foo[], and char foo[][] ?
  5. Date: 17 Apr 1996 15:46:28 GMT
  6. Organization: Lectra Systemes, Cestas, France
  7. Distribution: world
  8. Message-ID: <4l33ok$oo2@Sherlock.lectra.fr>
  9. NNTP-Posting-Host: noe.lectra.fr
  10.  
  11. Considering the 3 following declarations:
  12.  
  13. 1 - char **foo;
  14. 2 - char *foo[];
  15. 3 - char foo[][];
  16.  
  17. I know that there is a (big !) difference in memory reservation, but I do not know
  18. if foo IS or IS NOT of the same type in these three cases.
  19.  
  20. To summarize my question :
  21. Is the first one securely usable for casting a variable of the third kind, when
  22. calling a function where it is defined as the second kind ?
  23.  
  24. Follwing is a description (the 2 functions are in differents sources files) :
  25.  
  26. myexample()
  27. {
  28.     char foo[MAX_X][MAX_Y];
  29.     ...
  30.     myfunc( (char **)foo );
  31. }
  32.  
  33. void myfunc( char *foo[MAX_X] )
  34. {
  35. ...
  36. }
  37.  
  38. Can anybody help me ? Is it system-dependent ?
  39.  
  40. Many thanks in advance,
  41.  
  42. Philippe.
  43.  
  44. -- 
  45. +-----------------------------+-----------------------------+
  46. | Philippe MAURISSET          |                             |
  47. | Lectra Systemes             | Phil@RD.Lectra.fr           |
  48. | Chemin de Marticot, BP 34   | tel   :     +33 57.97.80.00 |
  49. | 33611 CESTAS Cedex          | direct:     +33 57.97.81.13 |
  50. | FRANCE                      | fax   :     +33 57.97.82.32 |
  51. +-----------------------------+-----------------------------+
  52.